<?php
require('config.php');

        $user_id=$_REQUEST['user_id'];
		$sql="select * from `".$oto."_money_record` where `userid`='".$user_id."' and type!='0' order by `time` DESC";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$user_info[]=$row;//将取得的所有数据赋值给person_info数组
		}
		for($i=0;$i<count($user_info);$i++)
		{
			if($user_info[$i]['type']==1 || $user_info[$i]['type']==2)
			{
				$order_id=$user_info[$i]['orderNo'];
				$sql="select * from `".$oto."_orders`,`".$oto."_shops` where ".$oto."_orders.shopId=".$oto."_shops.shopId and `orderNo`='".$order_id."'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$order_shop_info[$i][]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(!isset($order_shop_info[$i]))
				{
					$user_info[$i]['logo']='../image/shanghu_logo.png';
					$user_info[$i]['pan']=1;
				}
				else
				{
					$user_info[$i]['logo']=$order_shop_info[$i][0]['shopImg'];
					$user_info[$i]['pan']=0;
				}
			}
			else if($user_info[$i]['type']==3)
			{
				if($user_info[$i]['payWay']==0) $user_info[$i]['logo']='../image/shanghu_logo.png';
				if($user_info[$i]['payWay']==1) $user_info[$i]['logo']='../image/zhifubao.png';
				if($user_info[$i]['payWay']==2) $user_info[$i]['logo']='../image/weixin.png';
				$user_info[$i]['pan']=1;
			}
			else
			{
				$user_info[$i]['logo']='../image/shanghu_logo.png';
			}
			if($user_info[$i]['remark']=="")
			{
				if($user_info[$i]['type']==1) $user_info[$i]['remark']='购买商品';
				else if($user_info[$i]['type']==2) $user_info[$i]['remark']='订单退款';
				else if($user_info[$i]['type']==3)
				{
					if($user_info[$i]['payWay']==1) $user_info[$i]['remark']='支付宝充值';
					else if($user_info[$i]['payWay']==2) $user_info[$i]['remark']='微信充值';
					else $user_info[$i]['remark']='其他充值方式';
				} 
				else if($user_info[$i]['type']==4) $user_info[$i]['remark']='佣金提现';
				else if($user_info[$i]['type']==5) $user_info[$i]['remark']='订单无效';
				else $user_info[$i]['remark']='其他';
			}
		}
		echo json_encode($user_info);
?>